package com.jwdf.uda.ui.activity.presenter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;

import com.jwdf.uda.R;
import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.event.GuideDetailEvent;
import com.jwdf.uda.event.GuideDetailItemClickEvent;
import com.jwdf.uda.event.GuideTabCountEvent;
import com.jwdf.uda.event.StylistGuideEvent;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.HttpHelper;
import com.jwdf.uda.http.action.GuideAddEvaluationAction;
import com.jwdf.uda.http.action.GuideContinueGuideAction;
import com.jwdf.uda.http.action.GuideDelCommentAction;
import com.jwdf.uda.http.action.GuideDelInteractionAction;
import com.jwdf.uda.http.action.GuideDesignerFinishAction;
import com.jwdf.uda.http.action.GuideDesignerResponseAction;
import com.jwdf.uda.http.action.GuideDetailAction;
import com.jwdf.uda.http.action.GuideGetCommentListAction;
import com.jwdf.uda.http.action.GuideLikeAction;
import com.jwdf.uda.http.action.GuideSetPublicAction;
import com.jwdf.uda.http.action.GuideUnLikeAction;
import com.jwdf.uda.ui.activity.GuideCommentAddActivity;
import com.jwdf.uda.ui.activity.GuideDetailActivity;
import com.jwdf.uda.ui.activity.GuideInteractionAddActivity;
import com.jwdf.uda.ui.activity.GuideRespondActivity;
import com.jwdf.uda.ui.activity.ReplyAnswerCmtActivity;
import com.jwdf.uda.ui.activity.view.IGuideDetailView;
import com.jwdf.uda.ui.adapter.item.GuideDetailItem;
import com.jwdf.uda.utils.ClipUtils;
import com.jwdf.uda.utils.ConfigUtils;
import com.jwdf.uda.utils.EventBusUtil;
import com.jwdf.uda.utils.ShareUtil;
import com.jwdf.uda.utils.StringUtils;
import com.jwdf.uda.utils.ToastUtils;

import retrofit2.Response;

/**
 * 类说明：
 */
public class GuideDetailPresenter extends APresenter<IGuideDetailView> {
    private int mGuideId;//搭配详情ID
    private PbBean.PbResGuideDetail mDetail;
    private GuideModel mGuideModel;
    private boolean mIsLike = false;//是否点赞
    private boolean mIsPublic = false;//是否设置公开
    private GuideDetailItem.GuideTab mDefTab;

    public GuideDetailPresenter(IGuideDetailView iView, int guideId, int tabIndex) {
        super(iView);
        mGuideId = guideId;
        switch (tabIndex) {
            case 1:
                mDefTab = GuideDetailItem.GuideTab.LIKE;
                break;
        }
    }

    /**
     * 点击右上角按钮
     */
    public void onHeadActionClick() {
        doShareAction(getContext());
    }

    /**
     * 分享功能
     */
    public void doShareAction(Context context) {
        if (mDetail != null && !TextUtils.isEmpty(mDetail.getDetail().getShareUrl())) {
            ShareUtil.onekeyShare(context, mDetail.getDetail().getContent(), mDetail.getDetail().getShareUrl(),"");
        }
    }

    public void doPublicGuideAction() {
        mIView.getFragment().showProgressDialog();
        GuideSetPublicAction action = GuideSetPublicAction.newInstance(mIView.getFragment().getActivity(), mGuideId, !mIsPublic);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideSetPublic>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideSetPublic> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    mIsPublic = !mIsPublic;
                    ToastUtils.show(mIView.getFragment().getActivity(), R.string.guide_operate_success);
                    mIView.showPublicView(mIsPublic);
                }
            }
        }));
    }

    /**
     * 搭配师响应用户请求
     */
    public void doStylistAnswerAction() {
        mIView.getFragment().showProgressDialog();
        GuideDesignerResponseAction action = GuideDesignerResponseAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideDesignerResponse>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideDesignerResponse> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    EventBusUtil.post(StylistGuideEvent.newInstance());
                    mIView.showBottomStatusStylistUnderway();
                }
            }
        }));
    }

    /**
     * 点赞请求
     *
     * @param v
     */
    public void doPraiseGuideAction(View v) {
        if (mIsLike) {
            doUnLikeGuideAction(v);
        } else {
            doLikeGuideAction(v);
        }
    }

    private void doLikeGuideAction(final View v) {
//        mIView.getFragment().showProgressDialog();
        GuideLikeAction action = GuideLikeAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideLike>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideLike> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
//                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doLikeGuideResponse();

                    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.4f, 0.0f, 1.4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                    animation.setDuration(300);//设置动画持续时间
                    v.startAnimation(animation);
                }
            }
        }));
    }

    private void doLikeGuideResponse() {
        mIsLike = true;
        mIView.showPraiseView(mIsLike);
        requestDetail();
    }

    private void doUnLikeGuideAction(final View v) {
//        mIView.getFragment().showProgressDialog();
        GuideUnLikeAction action = GuideUnLikeAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideUnLike>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideUnLike> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
//                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doUnLikeGuideResponse();

                    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.4f, 0.0f, 1.4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                    animation.setDuration(300);//设置动画持续时间
                    v.startAnimation(animation);
                }
            }
        }));
    }

    private void doUnLikeGuideResponse() {
        mIsLike = false;
        mIView.showPraiseView(mIsLike);
        requestDetail();
    }

    /**
     * 评价请求
     *
     * @param evaluation
     */
    public void doEvaluationGuideAction(PbBean.PbSignGuideEvaluation evaluation) {
        mIView.getFragment().showProgressDialog();
        GuideAddEvaluationAction action = GuideAddEvaluationAction.newInstance(mIView.getFragment().getActivity(), mGuideId, evaluation);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideAddEvaluation>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideAddEvaluation> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    requestDetail();
                }
            }
        }));
    }

    /**
     * 获取详情数据
     */
    public void requestDetail() {
        if (mIView.getAdapterCount() == 0) {
            mIView.getFragment().showProgressDialog();
        }
        GuideDetailAction action = GuideDetailAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideDetail>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideDetail> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doSuccessResponse(response.body());
                }
            }
        }));
    }

    public void requestDetail(final PbBean.PbSignInteractionListSortType sortType) {
        if (mIView.getAdapterCount() == 0) {
            mIView.getFragment().showProgressDialog();
        }
        GuideDetailAction action = GuideDetailAction.newInstance(mIView.getFragment().getActivity(), mGuideId, sortType);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideDetail>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideDetail> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doSuccessResponse(sortType,response.body());
                }
            }
        }));
    }

    private void doSuccessResponse(PbBean.PbResGuideDetail body) {
        this.mDetail = body;
        if (mDetail == null) return;
        //判断是什么模式
        setGuideModel();
        //显示数据
        mIView.showDetailData(mDetail);
        EventBusUtil.post(GuideTabCountEvent.newInstanceForComment(mGuideId, mDetail.getDetail().getCommentCount()));
        EventBusUtil.post(GuideTabCountEvent.newInstanceForLike(mGuideId, mDetail.getLikeListCount()));
        if (mIView.getCurrentTab() == GuideDetailItem.GuideTab.COMMENT) {
            mIView.setPullLoadEnable(mDetail.getDetail().getCommentCount() == ((GuideDetailActivity.GuideDetailFragment) mIView.getFragment()).getPageLength());
        } else {
            mIView.setPullLoadEnable(false);
        }
        mIsLike = mDetail.getDetail().getIsLike();
        mIsPublic = mDetail.getDetail().getIsPublic();

        //设置底部状态信息
        if (mDetail.getDetail().getStatus() == PbBean.PbSignGuideStatus.GUIDE_STATUS_FINISHED) {
            mIView.showBottomGuideView(mDetail.getDetail().getCommentCount(), mDetail.getLikeListCount());
            if (isUserModel()) {
                mIView.showPublicView(mIsPublic);
            }
            mIView.showPraiseView(mIsLike);
        } else {
            switch (mDetail.getDetail().getStatus()) {
                case GUIDE_STATUS_WAIT://等待
                    showBottomStatusWait();
                    break;
                case GUIDE_STATUS_UNDERWAY://进行中
                case GUIDE_STATUS_BACK://用户回退至进行中
                    showBottomStatusUnderway();
                    break;
                case GUIDE_STATUS_DESIGNER_FINISHED:
                    showBottomStatusDesignerFinish();
                    break;
                case GUIDE_STATUS_EVALUATION:
                    showBottomStatusEvaluation();
                    break;
                case GUIDE_STATUS_CANCEL:
                    showBottomStatusCancel();
                    break;
            }
            if (isStylistModel()) {
                mIView.showTaChestView();
            }
        }

        if (mDefTab != null) {
            mIView.setCurrentTab(mDefTab);
            mDefTab = null;
        }
    }

    private void doSuccessResponse(PbBean.PbSignInteractionListSortType sort, PbBean.PbResGuideDetail body) {
        doSuccessResponse(body);
        String sortType = "按时间降序";
        if (PbBean.PbSignInteractionListSortType.INTERACTION_LIST_SORT_TYPE_TIME_ASC == sort) {
            sortType = "按时间升序";
        } else if (PbBean.PbSignInteractionListSortType.INTERACTION_LIST_SORT_TYPE_TIME_DESC == sort) {
            sortType = "按时间降序";
        }
        EventBusUtil.post(new GuideDetailEvent(GuideDetailEvent.EVENT_DO_SORT, sortType));
    }

    //是否发布者模式
    private boolean isUserModel() {
        return mGuideModel == GuideModel.USER;
    }

    private void showBottomStatusWait() {
        if (isUserModel())
            mIView.showBottomStatusUserWait();
        if (isStylistModel())
            mIView.showBottomStatusStylistAnswer();
    }

    //是否设计师模式
    private boolean isStylistModel() {
        return mGuideModel == GuideModel.STYLIST;
    }

    private void showBottomStatusUnderway() {
        if (isUserModel())
            mIView.showBottomStatusUserUnderway();
        if (isStylistModel())
            mIView.showBottomStatusStylistUnderway();
    }

    private void showBottomStatusDesignerFinish() {
        if (isUserModel())
            mIView.showBottomStatusUserDesignerFinish();
        if (isStylistModel())
            mIView.showBottomStatusStylistDesignerFinish();
    }

    private void showBottomStatusEvaluation() {
        if (isUserModel())
            mIView.showBottomStatusUserEvaluation();
        if (isStylistModel())
            mIView.showBottomStatusStylistEvaluation();
    }

    private void showBottomStatusCancel() {
        mIView.showBottomStatusCancel();
    }

    //判断指导模式（普通者、发布者、设计师）
    private void setGuideModel() {
        //TODO
        mGuideModel = GuideModel.NAL;
        if (mDetail.getDetail().getUserInfo().getUserId() != null && mDetail.getDetail().getUserInfo().getUserId().equals(ConfigUtils.getUserId(mIView.getFragment().getActivity()))) {
            mGuideModel = GuideModel.USER;
        } else {
            if (mDetail.getDesignerInfo() != null && (mDetail.getDesignerInfo().getUserId() == null || "".equals(mDetail.getDesignerInfo().getUserId()))) {
                mGuideModel = GuideModel.STYLIST;
            }
            if (mDetail.getDesignerInfo() != null && mDetail.getDesignerInfo().getUserId().equals(ConfigUtils.getUserId(mIView.getFragment().getActivity()))) {
                mGuideModel = GuideModel.STYLIST;
            }
        }
    }

    /**
     * 结束指导请求
     */
    public void doDesignerFinishGuideAction() {
        mIView.getFragment().showProgressDialog();
        GuideDesignerFinishAction action = GuideDesignerFinishAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideDesignerFinish>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideDesignerFinish> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    mIView.showBottomStatusStylistDesignerFinish();
                }
            }
        }));
    }

    /**
     * 继续指导请求
     */
    public void doContinueGuideAction() {
        mIView.getFragment().showProgressDialog();
        GuideContinueGuideAction action = GuideContinueGuideAction.newInstance(mIView.getFragment().getActivity(), mGuideId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResGuideContinueGuide>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResGuideContinueGuide> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    mIView.showBottomStatusUserUnderway();
                }
            }
        }));
    }

    /**
     * 复制功能
     */
    public void doCopyContentAction(String content) {
        ClipUtils.copy(mIView.getFragment().getActivity(), StringUtils.filterNullAndTrim(content));
        ToastUtils.show(mIView.getFragment().getContext(), R.string.toast_copy_success);
    }

    /**
     * 删除互动信息
     */

    public void doDelInteractionAction(int interactionId) {
//        mIView.getFragment().showProgressDialog();
        GuideDelInteractionAction action = GuideDelInteractionAction.newInstance(mIView.getFragment().getActivity(), interactionId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResCommentDelComment>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResCommentDelComment> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
//                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doDelInteractionSuccess();
                }
            }
        }));
    }

    private void doDelInteractionSuccess() {
        //刷新
        requestDetail();
    }

    /**
     * 删除评论
     */
    public void doDelCommentAction(int commentId) {
        mIView.getFragment().showProgressDialog();
        GuideDelCommentAction action = GuideDelCommentAction.newInstance(mIView.getFragment().getActivity(), commentId);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResCommentDelComment>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResCommentDelComment> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doDelCommentSuccess();
                }
            }
        }));
    }

    private void doDelCommentSuccess() {
        //刷新
        requestDetail();
    }

    public void showFinishGuideDialog() {
        mIView.showFinishGuideDialog();
    }

    public void showFinishConfirmDialog() {
        mIView.showFinishConfirmDialog();
    }

    public void showFinishEvaluationDialog() {
        mIView.showFinishEvaluationDialog();
    }

    public void showDelInteractionDialog(int interactionId) {
        mIView.showDelInteractionDialog(interactionId);
    }

    public void showDelCommentDialog(int commentId) {
        mIView.showDelCommentDialog(commentId);
    }

    public void toGuideCommentAddActivity() {
//        GuideCommentAddActivity.startActivity(mIView.getFragment().getActivity(), mGuideId);
        ReplyAnswerCmtActivity.startActivity(mIView.getFragment().getActivity(), mGuideId, PbBean.PbSignNavType.LINK_TYPE_GUIDE);
    }

    public void toGuideCommentAddActivity(int atCommentId, String atNickname) {
        GuideCommentAddActivity.startActivity(mIView.getFragment().getActivity(), mGuideId, atCommentId, atNickname);
    }

    public void toGuideInteractionAddActivity() {
        GuideInteractionAddActivity.startActivity(mIView.getFragment().getActivity(), mGuideId, mDetail.getDesignerInfo().getUserId());
    }

    public void toGuideRespondActivity() {
        GuideRespondActivity.startActivity(mIView.getFragment().getActivity(), mGuideId);
    }

    public void onEventMainThread(GuideDetailEvent event) {
        switch (event.getEvent()) {
            case GuideDetailEvent.EVENT_REQ_CANCEL:
                requestDetail();
                break;
            case GuideDetailEvent.EVENT_INTERACTION_ADD:
                requestDetail();
                break;
            case GuideDetailEvent.EVENT_COMMENT_ADD:
                getCommentListAction(0);
                break;
            case GuideDetailEvent.EVENT_TAB_COMMENT:
                mIView.setCurrentTab(GuideDetailItem.GuideTab.COMMENT);
                mIView.setPullLoadEnable(event.count == ((GuideDetailActivity.GuideDetailFragment) mIView.getFragment()).getPageLength());
                break;
            case GuideDetailEvent.EVENT_TAB_LIKE:
                mIView.setCurrentTab(GuideDetailItem.GuideTab.LIKE);
                mIView.setPullLoadEnable(event.count == ((GuideDetailActivity.GuideDetailFragment) mIView.getFragment()).getPageLength());
                break;
            case GuideDetailEvent.EVENT_SHOW_DROP_MENU:
                mIView.showTabSortMenu(event.anchor);
                break;
        }
    }

    public void getCommentListAction(final int offset) {
        mIView.getFragment().showProgressDialog();
        GuideGetCommentListAction action = GuideGetCommentListAction.newInstance(mIView.getFragment().getActivity(), mGuideId, offset, PbBean.PbSignNavType.LINK_TYPE_GUIDE);
        mIView.getFragment().onNewRequestCall(action.request(new AHttpService.IResCallback<PbBean.PbResCommentGetCommentList>() {
            @Override
            public void onCallback(int resultCode, Response<PbBean.PbResCommentGetCommentList> response, PbBean.PbBaseServerInfo baseServerInfo) {
                if (mIView.getFragment().getView() != null) {
                    mIView.getFragment().closeProgressDialog();
                    if (HttpHelper.showError(mIView.getFragment().getActivity(), resultCode, baseServerInfo, R.string.error_operation)) {
                        return;
                    }
                    doLoadCommentListSuccess(offset, response.body());
                }
            }
        }));
    }

    private void doLoadCommentListSuccess(int offset, PbBean.PbResCommentGetCommentList comments) {
        if (offset > 0) {
            mIView.loadMoreComments(comments.getCommentListList());
        } else {
            mIView.refreshComments(comments.getCommentListList(), comments.getCommentListCount());
            EventBusUtil.post(GuideTabCountEvent.newInstanceForComment(mGuideId, comments.getCommentListCount()));
        }
        setPullLoadEnable(comments.getCommentListCount() == ((GuideDetailActivity.GuideDetailFragment) mIView.getFragment()).getPageLength());
    }

    public void setPullLoadEnable(boolean enable) {
        mIView.setPullLoadEnable(enable);
    }

    public void onEventMainThread(GuideDetailItemClickEvent event) {
        GuideDetailItem item = event.getItem();
        switch (item.itemType) {
            case GuideDetailItem.TYPE_USER_TXT:
            case GuideDetailItem.TYPE_USER_SINGLE_IMAGE:
            case GuideDetailItem.TYPE_USER_MULTI_IMAGE:
                break;
            case GuideDetailItem.TYPE_INTERACTION_TXT:
            case GuideDetailItem.TYPE_INTERACTION_SINGLE_IMAGE:
            case GuideDetailItem.TYPE_INTERACTION_MULTI_IMAGE:
                showInteractionChoiceDialog(item.interaction, item.pbSignGuideStatus);
                break;
            case GuideDetailItem.TYPE_COMMENT_TXT:
            case GuideDetailItem.TYPE_COMMENT_SINGLE_IMAGE:
            case GuideDetailItem.TYPE_COMMENT_MULTI_IMAGE:
                showCommentChoiceDialog(item.comment);
                break;
        }
    }

    public void showInteractionChoiceDialog(PbBean.PbGuideInteraction interaction, PbBean.PbSignGuideStatus pbSignGuideStatus) {
        PbBean.PbUserSimple userInfo = interaction.getUserInfo();
        if (userInfo.getUserId() != null && userInfo.getUserId().equals(ConfigUtils.getUserId(mIView.getFragment().getContext())) && pbSignGuideStatus != PbBean.PbSignGuideStatus.GUIDE_STATUS_FINISHED) {
            mIView.showInteractionChoiceDialog(interaction, true);
        } else {
            mIView.showInteractionChoiceDialog(interaction, false);
        }
    }

    public void showCommentChoiceDialog(PbBean.PbBaseComment comment) {
        PbBean.PbUserSimple userInfo = comment.getUserInfo();
        if (userInfo.getUserId() != null && userInfo.getUserId().equals(ConfigUtils.getUserId(mIView.getFragment().getContext()))) {
            mIView.showCommentChoiceDialog(comment, true);
        } else {
            mIView.showCommentChoiceDialog(comment, false);
        }
    }

    private enum GuideModel {
        NAL, USER, STYLIST
    }

}
